package scriptEngine

import "gitee.com/fierce_wolf/go-fox-edge-common/edgeEntity"

var (
	service   *scriptEngineService
	loader    *scriptEngineLoader
	subscribe *subscribesTopic
)

func init() {
	service = &scriptEngineService{}
	loader = &scriptEngineLoader{}
	subscribe = &subscribesTopic{}
}

func Initialized() (err error) {
	return loader.initialized()
}

func Subscribes() []string {
	return subscribe.keys()
}

func OperationKeys(topic string) []string {
	return subscribe.getOperationKeys(topic)
}

func GetScriptEngine(operateEntityKey string) (*Decoder, error) {
	return service.getScriptEngine(operateEntityKey)
}

func RebindScriptEngine(operateEntity *edgeEntity.OperateEntity) error {
	return service.rebindScriptEngine(operateEntity)
}
